package com.sunl.mall.ali.mq.api.producer;

import com.aliyun.openservices.ons.api.transaction.TransactionStatus;
import com.sunl.mall.ali.mq.model.transaction.RocketMqTransactionMessageWrapper;
import com.sunl.mall.ali.mq.model.transaction.RocketMqTransactionMessageContext;

@FunctionalInterface
public interface RocketMqLocalTransactionExecutor<T> {
    /**
     * 本地事务执行逻辑
     *
     * @param message 消息体
     * @param args    执行逻辑中使用
     * @param context 上下文
     * @return 事务狀態 只要返回的不是commit 或rollback 则直接unknow
     */
    TransactionStatus execute(RocketMqTransactionMessageWrapper<T> message, Object args, RocketMqTransactionMessageContext context);
}
